package com.ymttest.database.sqlwapper.sqmarketing;

import java.util.List;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.sqmarketing.ActivityConditionItem;

public class ActivityConditionItemWrapper {

	SqlManager manager;

	public ActivityConditionItemWrapper() {
		manager = new SqlManager("sqmarketing");
	}

	@SuppressWarnings("unchecked")
	public ActivityConditionItem selectByPrimaryKey(Long id) {

		ActivityConditionItem activityConditionItem = null;

		List<ActivityConditionItem> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.sqmarketing.ActivityConditionItemMapper.selectByPrimaryKey",
						id);
		manager.commit();

		if (result.size() > 0)
			activityConditionItem = result.get(0);

		return activityConditionItem;
	}
	
	@SuppressWarnings("unchecked")
	public ActivityConditionItem selectByActivityId(Long activityId) {

		ActivityConditionItem activityConditionItem = null;

		List<ActivityConditionItem> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.sqmarketing.ActivityConditionItemMapper.selectByActivityId",
						activityId);
		manager.commit();

		if (result.size() > 0)
			activityConditionItem = result.get(0);

		return activityConditionItem;
	}
	
	@SuppressWarnings("unchecked")
	public List<ActivityConditionItem> selectItemsByActivityId(Long activityId) {

		List<ActivityConditionItem> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.sqmarketing.ActivityConditionItemMapper.selectItemsByActivityId",
						activityId);
		manager.commit();

		return result;
	}
	
	public static void main(String[] args) {
		
		ActivityConditionItemWrapper wrapper = new ActivityConditionItemWrapper();

		System.out.println(wrapper.selectByPrimaryKey(1L));
	}
}
